// import { resolve } from 'path'
import { defineConfig4CustomTheme } from 'vuepress/config'
import { VdoingThemeConfig } from 'vuepress-theme-vdoing/types'
import dayjs from 'dayjs'

export default defineConfig4CustomTheme<VdoingThemeConfig>({
  theme: 'vdoing', // 使用npm包主题
  port: 1438,
  // theme: resolve(__dirname, '../../vdoing'), // 使用本地主题
  locales: {
    '/': {
      lang: 'zh-CN',
      title: "猫黑的旅行笔记",
      description: '猫黑的个人前端博客。',
    }
  },
  // base: '/', // 默认'/'。如果你想将你的网站部署到如 https://foo.github.io/bar/，那么 base 应该被设置成 "/bar/",（否则页面将失去样式等文件）

  // 主题配置
  themeConfig: {
    // 导航配置
    nav: [
      { text: '首页', link: '/' },
      {
        text: '前端',
        link: '/web/', //目录页链接，此处link是vdoing主题新增的配置项，有二级导航时，可以点击一级导航跳到目录页
      },
      {
        text: '工具',
        link: '/tool/',
        items: [
          { text: '1-实用桌面软件', link: '/pages/485a0d/' },
          { text: '2-实用工具网页', link: '/pages/de970c/' },
        ],
      },
      {
        text: '笔记',
        link: '/note/',
        items: [
          {
            text: '网站搭建',
            items: [
              { text: '1-服务器', link: '/pages/787e43/' },
              { text: '2-博客建设', link: '/pages/facd6c/' },
              { text: '3-Git自动部署', link: '/pages/f382b9/' },
            ],
          },
          {
            text: '开发笔记',
            items: [
              { text: '1-技巧总结', link: '/pages/258998/' },
              { text: '2-常见问题', link: '/pages/4c2d38/' },
            ],
          },
        ],
      },
      {
        text: '更多',
        link: '/more/',
        items: [
          { text: '技术文档', link: '/technology/' },
          { text: '待思考学习', link: '/pages/1f1d1e/' },
          { text: '日记', link: '/noteDay/' }
        ],
      },
      {
        text: '索引',
        link: '/archives/',
        items: [
          { text: '分类', link: '/categories/' },
          { text: '标签', link: '/tags/' },
          { text: '归档', link: '/archives/' },
        ],
      },
    ],
    sidebarDepth: 2, // 侧边栏显示深度，默认1，最大2（显示到h3标题）
    logo: '/home/headlogo.jpg', // 导航栏logo
    repoType: 'Gitee',
    repo: 'https://gitee.com/catblack-git/catblack-blog', // 导航栏右侧生成Github链接
    searchMaxSuggestions: 10, // 搜索结果显示最大数
    lastUpdated: '上次更新', // 开启更新时间，并配置前缀文字   string | boolean (取值为git提交时间)
    docsDir: 'docs', // 编辑的文件夹
    editLinks: true, // 启用编辑
    editLinkText: '编辑',

    // 侧边栏  'structuring' | { mode: 'structuring', collapsable: Boolean} | 'auto' | <自定义>    温馨提示：目录页数据依赖于结构化的侧边栏数据，如果你不设置为'structuring',将无法使用目录页
    sidebar: 'structuring',

    // 文章默认的作者信息，(可在md文件中单独配置此信息) string | {name: string, link?: string}
    author: {
      name: '猫黑', // 必需
      link: 'https://gitee.com/catblack-git', // 可选的
    },

    // 博主信息 (显示在首页侧边栏)
    blogger: {
      avatar: '/home/avarter.jpg',
      name: '猫黑',
      slogan: '光之战士、峡谷召唤师',
    },

    // 社交图标 (显示于博主信息栏和页脚栏。内置图标：https://doc.xugaoyi.com/pages/a20ce8/#social)
    social: {
      // iconfontCssFile: '//at.alicdn.com/t/xxx.css', // 可选，阿里图标库在线css文件地址，对于主题没有的图标可自己添加。阿里图片库：https://www.iconfont.cn/
      icons: [
        {
          iconClass: 'icon-youjian',
          title: '发邮件',
          link: 'mailto:1438828647@qq.com',
        },
        {
          iconClass: 'icon-gitee',
          title: 'gitee',
          link: 'https://gitee.com/catblack-git',
        },
        {
          iconClass: 'icon-erji',
          title: '听音乐',
          link: 'https://music.163.com/#/playlist?id=755597173',
        },
      ],
    },
        // 页脚信息
    footer: {
      createYear: 2020, // 博客创建年份
      copyrightInfo:
        'Evan Xu | <a href="https://github.com/xugaoyi/vuepress-theme-vdoing/blob/master/LICENSE" target="_blank">MIT License</a>', // 博客版权信息，支持a标签或换行标签</br>
    },
  },

  // 注入到页面<head>中的标签，格式[tagName, { attrName: attrValue }, innerHTML?]
  head: [
    ['link', { rel: 'icon', href: './img/favicon.ico' }], //favicons，资源放在public文件夹
    [
      'meta',
      {
        name: 'keywords',
        content: '前端博客,个人技术博客,前端,前端开发,前端框架,web前端,前端面试题,技术文档,学习,面试,JavaScript,js,ES6,TypeScript,vue,python,css3,html5,Node,git,github,markdown',
      },
    ],
    ['meta', { name: 'theme-color', content: '#11a8cd' }], // 移动浏览器主题颜色
  ],

  // 插件配置
  plugins: {

    // 全文搜索
    'fulltext-search': {},

    // 代码块复制按钮
    'one-click-copy': {
      copySelector: ['div[class*="language-"] pre', 'div[class*="aside-code"] aside'], // String or Array
      copyMessage: '复制成功', // default is 'Copy successfully and then paste it for use.'
      duration: 1000, // prompt message display time.
      showInMobile: false, // whether to display on the mobile side, default: false.
    },

    // DEMO演示模块, API: https://github.com/xiguaxigua/vuepress-plugin-demo-block
    'demo-container': {},

    // 放大图片
    'vuepress-plugin-zooming': {
      selector: '.theme-vdoing-content img:not(.no-zoom)', // not排除class是no-zoom的图片
      options: {
        bgColor: 'rgba(0,0,0,0.6)',
      },
    },

    // "上次更新"的时间格式
    '@vuepress/last-updated': {
      transformer: (timestamp, lang) => {
        return dayjs(timestamp).format('YYYY/MM/DD, HH:mm:ss')
      },
    },
  },

  markdown: {
    lineNumbers: true
  }
})
